
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;

namespace Swaf.Config
{
	/// <summary>
	/// When implemented by a class, the configuration system will use it
	/// to help parse the contents of a configuration file.</summary>
	/// <remarks>
	/// There are several different classes within the framework that implement the
	/// <c>IConfigPartner</c> interface in order to process specific elements within
	/// the application configuration file.
	/// <p>
	/// Typically a class that implements this interface also gets registered within
	/// the <c>ConfigurationClasses</c> section of the application config file.</p>
	/// <code>
	/// <ConfigurationClasses>
	///		<Class name="abc">ClassNamespace.ClassName,ClassAssemplyName</Class>
	///	</ConfigurationClasses>
	/// </code>
	/// <p>
	/// When the <c>ConfigManager</c> starts processing the XML configuration
	/// document and processes the <c>ConfigurationClassers</c> element, it
	/// will create an instance of the <c>IConfigPartner</c> classes and call the
	/// <c>IConfigPartner.registerForConfig</c> method.  Implementations should
	/// register one or more objects that implement the <c>ConfigHandler</c>
	/// class by calling <c>ConfigManager.registerHandler</c> passing the XML
	/// path and a <c>ConfigHandler</c> for the element it processes.</p></remarks>
	public interface IConfigPartner
	{
		/// <summary>
		/// Called by <c>Swaf.Config.ConfigManager</c> to register
		/// <c>configHandler</c> objects with paths into the configuration file
		/// that will help to do processing.
		/// </summary>
		/// <param name="config">The instance of the <c>ConfigManager</c> that
		/// the object's <c>ConfigHandler</c> should be registered with.</param>
		void registerForConfig(IConfigManager config);

		/// <summary>
		/// Called by <c>Swaf.Config.ConfigManager</c> at the end of startup
		/// config processing to determine if the config partner has problems with the
		/// configuration of the system.  
		/// </summary>
		/// <remarks>Implementations should throw an exception when indicating that there
		/// was a serious problem with its configuration.  For other issues, it should simple
		/// log its information.</remarks>
		void checkConfigStatus();
	}
}
